# -*- coding: utf-8 -*-
from utils.operators.spark_submit import SparkSubmitOperator
from datetime import timedelta

from jms.dim.dim_sys_network_detail_dt import jms_dim__dim_sys_network_detail_dt
from jms.dwd.oms.dwd_yl_oms_oms_waybill_incre_dt import jms_dwd__dwd_yl_oms_oms_waybill_incre_dt
from jms.ods.lmdm.yl_lmdm_sys_staff import  jms_ods__yl_lmdm_sys_staff
from jms.ods.mysql.sys_manage_region import jms_ods__sys_manage_region
from jms.dim.dim_lmdm_sys_special_time_limit_base import jms_dim__dim_lmdm_sys_special_time_limit_base
from jms.ods.lmdm.yl_lmdm_sys_area import jms_ods__yl_lmdm_sys_area
from jms.ods.oms.yl_oms_interceptorpiece import jms_ods__yl_oms_interceptorpiece
from jms.dwd.tab.dwd_tab_reback_transfer_express_base import jms_dwd__dwd_tab_reback_transfer_express_base
from jms.ods.tab.tab_end_piece import jms_ods__tab_end_piece
from jms.ods.tab.tab_barscan_difficult import jms_ods__tab_barscan_difficult
from jms.ods.tab.tab_barscan_send import jms_ods__tab_barscan_send
from jms.ods.tab.tab_barscan_sitearrival import jms_ods__tab_barscan_sitearrival
from jms.ods.tab.tab_barscan_deliver import jms_ods__tab_barscan_deliver
from jms.ods.tab.tab_barscan_sign import jms_ods__tab_barscan_sign
from jms.ods.tab.tab_barscan_collect import jms_ods__tab_barscan_collect
from jms.ods.tab.tab_barscan_sitesend import jms_ods__tab_barscan_sitesend
from jms.ods.lmdm.yl_lmdm_sys_abnormal_piece import jms_ods__yl_lmdm_sys_abnormal_piece
from jms.dwd.tab.dwd_tab_barscan_transfer_mail_base_dt import jms_dwd__dwd_tab_barscan_transfer_mail_base_dt
from jms.ods.tms.yl_tmsnew_download_effective import jms_ods__yl_tmsnew_download_effective
from jms.dim.dim_cn_three_codes_dt import jms_dim__dim_cn_three_codes_dt
from jms.dim.dim_lmdm_sys_tail_code_town_base import jms_dim__dim_lmdm_sys_tail_code_town_base
from jms.ods.tms.yl_tmsnew_download_effective_di import jms_ods__yl_tmsnew_download_effective_di
jms_dm__dm_terminal_sign_all_detail_new_dt = SparkSubmitOperator(
    task_id='jms_dm__dm_terminal_sign_all_detail_new_dt',
    email=['houwenlong@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_terminal_sign_all_detail_new_dt_dt_{{ execution_date | date_add(1) | cst_ds }}',  # yarn 任务名称
    pool_slots=5,
    driver_memory='20G',
    driver_cores=2,
    executor_memory='30G',
    executor_cores=4,
    num_executors=100,
    conf={'spark.sql.shuffle.partitions': 600,
          'spark.executor.memoryOverhead': 2048,
          'spark.core.connection.ack.wait.timeout': 300,
          'spark.default.parallelism': 600,
          'spark.locality.wait': 60,
          },
    jars='hdfs:///scheduler/jms/spark/chk/report/terminal_sign_all_detail_data_new/common-1.0-SNAPSHOT.jar',  # 依赖 jar 包
    java_class='com.yunlu.bigdata.jobs.report.TerminalSignAllDetailDataNew',  # spark 主类
    application='hdfs:///scheduler/jms/spark/chk/report/terminal_sign_all_detail_data_new/original-jobs-1.0-SNAPSHOT.jar',
    application_args=['{{ execution_date  | date_add(1)| cst_ds }}'],  # 参数dt 2020-10-26
    execution_timeout=timedelta(hours=1),
)
# 设置依赖
jms_dm__dm_terminal_sign_all_detail_new_dt << [
    jms_dim__dim_sys_network_detail_dt,
    jms_ods__yl_lmdm_sys_staff,
    jms_ods__sys_manage_region,
    jms_ods__yl_lmdm_sys_area,
    jms_dim__dim_lmdm_sys_special_time_limit_base,
    jms_dwd__dwd_yl_oms_oms_waybill_incre_dt,
    jms_ods__yl_oms_interceptorpiece,
    jms_dwd__dwd_tab_reback_transfer_express_base,
    jms_ods__tab_end_piece,
    jms_ods__tab_barscan_difficult,
    jms_ods__tab_barscan_send,
    jms_ods__tab_barscan_sitearrival,
    jms_ods__tab_barscan_sitesend,
    jms_ods__tab_barscan_deliver,
    jms_ods__tab_barscan_sign,
    jms_ods__tab_barscan_collect,
    jms_ods__yl_lmdm_sys_abnormal_piece,
    jms_dwd__dwd_tab_barscan_transfer_mail_base_dt,
    jms_ods__yl_tmsnew_download_effective,
    jms_dim__dim_cn_three_codes_dt,
    jms_dim__dim_lmdm_sys_tail_code_town_base,
    jms_ods__yl_tmsnew_download_effective_di
]


